#include <stdio.h>
#include "setting.h"
#include "virtual_flash.h"
#include <string.h>
#include "smart_sensor.h"
#include "comfun.h"
#include "protocol.h"
#include "sensor_archives.h"

int main()
{
    flash_init();
    setting_load();//参数加载
    dev_show();
    sensor_archives_load();

    //put_le_val(1,sensor_archives.sensor_infor[0].aid,AID_LEN);
    memset(sensor_archives.sensor_infor[0].aid,0x01,AID_LEN);
    sensor_archives.sensor_infor[0].seq = 1;
    sensor_archives.sensor_infor[0].flag = SENSOR_VALID;
    sensor_archives_save();
    memset(&sensor_archives,0xff,sizeof (sensor_archives));
    sensor_archives_load();
    sensor_archives_show(0);

    memset(sensor_archives.sensor_infor[0].aid,0x55,AID_LEN);
    sensor_archives.sensor_infor[0].seq = 2;
    sensor_archives.sensor_infor[0].flag = SENSOR_VALID;
    sensor_archives_save();
    memset(&sensor_archives,0xff,sizeof (sensor_archives));
    sensor_archives_load();
    sensor_archives_show(0);

    memset(sensor_archives.sensor_infor[0].aid,0x00,AID_LEN);
    sensor_archives.sensor_infor[0].seq = 3;
    sensor_archives.sensor_infor[0].flag = SENSOR_VALID;
    sensor_archives_save();
    memset(&sensor_archives,0xff,sizeof (sensor_archives));
    sensor_archives_load();
    sensor_archives_show(0);

    memset(sensor_archives.sensor_infor[1].aid,0x55,AID_LEN);
    sensor_archives.sensor_infor[1].seq = 5;
    sensor_archives.sensor_infor[1].flag = SENSOR_VALID;
    sensor_archives_save();
    memset(&sensor_archives,0xff,sizeof (sensor_archives));
    sensor_archives_load();
    sensor_archives_show(1);
    return 0;
}


